**************************************************************************
*																		*
*			Campaign Panel Book Chapter 5 - Attitudes 2013				*
*																		*
*************************************************************************

*******************************************************************************
**
** III. Mobilizing and demobilizing attitudes 
* These are mostly variables which are relevant for turnout specifically
* (and which were not part of the syntax for vote decision)
**
*******************************************************************************

use "${data}\ZA5704_en_v3-2-0.dta", clear


*******************************************************************************
** Communication variables

** Interest in the campaign

fre kp2_390
mvdecode kp?_390, mv(-99/-1)
foreach welle of numlist 2/6 {
	gen wkampfint`welle'=(5-kp`welle'_390)/4
	}

tab wkampfint2 kp2_390

// Replace values for waves in which campaign interest was not measured

gen wkampfint1=wkampfint2
gen wkampfint7=wkampfint6

********************************************************************************
* Political attitudes



* Election norm

tab1 kp1_050l, nolabel
mvdecode kp?_050?, mv(-99/-1)

foreach welle of numlist 1 3 7 {
	gen wahlnorm`welle'=(kp`welle'_050l-1)/4
	}
	
tab1 wahlnorm1 wahlnorm3 wahlnorm7
tabstat wahlnorm1 wahlnorm3 wahlnorm7


* Internal efficacy

foreach welle of numlist 1 3 7 {
	gen inteff1`welle'=(kp`welle'_050h-1)/4
	gen inteff2`welle'=(kp`welle'_050k-1)/4
	gen intefficacy`welle'=(inteff1`welle'+inteff2`welle')/2
	}
	
list lfdn intefficacy1	
	
tab1 intefficacy1 intefficacy3 intefficacy7
tabstat intefficacy1 intefficacy3 intefficacy7

/* This is not consistent with chapter 6. Here a weighted mean was
employed for missings by design if the gap was two waves or more */

egen intefficacy2= rowmean(intefficacy1 intefficacy3)

gen intefficacy4= 3/4*intefficacy3+ 1/4*intefficacy7
replace intefficacy4 = intefficacy3 if intefficacy7==.
replace intefficacy4 = intefficacy7 if intefficacy3==.

egen intefficacy5 = rowmean(intefficacy3 intefficacy7)

gen intefficacy6 = 1/4*intefficacy3+3/4*intefficacy7
replace intefficacy6 = intefficacy3 if intefficacy7==.
replace intefficacy6 = intefficacy7 if intefficacy3==.

tabstat intefficacy?

* External efficacy

foreach welle of numlist 1 3 7 {
	gen exteff1`welle'=(kp`welle'_050a-1)/4
	gen exteff2`welle'=(kp`welle'_050e-1)/4
	gen extefficacy`welle'=(exteff1`welle'+exteff2`welle')/2
	}
	
tab1 extefficacy1 extefficacy3 extefficacy7
tabstat extefficacy1 extefficacy3 extefficacy7

// Replace values for waves in which external efficacy was not measured

egen extefficacy2=rowmean (extefficacy1 extefficacy3)

gen extefficacy4= 3/4*extefficacy3+ 1/4*extefficacy7
replace extefficacy4 = extefficacy3 if extefficacy7==.
replace extefficacy4 = extefficacy7 if extefficacy3==.

egen extefficacy5 = rowmean(extefficacy3 extefficacy7)

gen extefficacy6 = 1/4*extefficacy3+3/4*extefficacy7
replace extefficacy6 = extefficacy3 if extefficacy7==.
replace extefficacy6 = extefficacy7 if extefficacy3==.

tabstat extefficacy?

* Satisfaction with democracy

tab1 kp1_020 kp7_020
tab1 kp1_020 kp7_020, nolabel
mvdecode kp?_020, mv(-99/-1)

gen zufr1=(5-kp1_020)/4
gen zufr7=(5-kp7_020)/4

gen zufr2 = 5/6*zufr1 + 1/6*zufr7
gen zufr3 = 4/6*zufr1 + 2/6*zufr7
gen zufr4 = 3/6*zufr1 + 3/6*zufr7
gen zufr5 = 2/6*zufr1 + 4/6*zufr7
gen zufr6 = 1/6*zufr1 + 5/6*zufr7

foreach welle of numlist 2/6 {
replace zufr`welle' = zufr1 if zufr7==.
replace zufr`welle' = zufr7 if zufr1==.
}


*******************************************************************************
* Evaluation scales (for indifference and alienation)

tab1 kp1_430a
tab1 kp1_430a, nolabel
mvdecode kp?_430?, mv(-99/-1)

// value range 0-1 //

tab1 kp1_430a-kp1_430i

gen skal_part_a1=(kp1_430a-1)/10
gen skal_part_b1=(kp1_430b-1)/10
gen skal_part_c1=(kp1_430c-1)/10
gen skal_part_d1=(kp1_430d-1)/10
gen skal_part_e1=(kp1_430e-1)/10
gen skal_part_f1=(kp1_430f-1)/10
gen skal_part_h1=(kp1_430h-1)/10
gen skal_part_i1=(kp1_430i-1)/10

gen skal_part_a2=(kp2_430a-1)/10
gen skal_part_b2=(kp2_430b-1)/10
gen skal_part_c2=(kp2_430c-1)/10
gen skal_part_d2=(kp2_430d-1)/10
gen skal_part_e2=(kp2_430e-1)/10
gen skal_part_f2=(kp2_430f-1)/10
gen skal_part_h2=(kp2_430h-1)/10
gen skal_part_i2=(kp2_430i-1)/10

gen skal_part_a3=(kp3_430a-1)/10
gen skal_part_b3=(kp3_430b-1)/10
gen skal_part_c3=(kp3_430c-1)/10
gen skal_part_d3=(kp3_430d-1)/10
gen skal_part_e3=(kp3_430e-1)/10
gen skal_part_f3=(kp3_430f-1)/10
gen skal_part_h3=(kp3_430h-1)/10
gen skal_part_i3=(kp3_430i-1)/10

gen skal_part_a4=(kp4_430a-1)/10
gen skal_part_b4=(kp4_430b-1)/10
gen skal_part_c4=(kp4_430c-1)/10
gen skal_part_d4=(kp4_430d-1)/10
gen skal_part_e4=(kp4_430e-1)/10
gen skal_part_f4=(kp4_430f-1)/10
gen skal_part_h4=(kp4_430h-1)/10
gen skal_part_i4=(kp4_430i-1)/10

gen skal_part_a5=(kp5_430a-1)/10
gen skal_part_b5=(kp5_430b-1)/10
gen skal_part_c5=(kp5_430c-1)/10
gen skal_part_d5=(kp5_430d-1)/10
gen skal_part_e5=(kp5_430e-1)/10
gen skal_part_f5=(kp5_430f-1)/10
gen skal_part_h5=(kp5_430h-1)/10
gen skal_part_i5=(kp5_430i-1)/10

gen skal_part_a6=(kp6_430a-1)/10
gen skal_part_b6=(kp6_430b-1)/10
gen skal_part_c6=(kp6_430c-1)/10
gen skal_part_d6=(kp6_430d-1)/10
gen skal_part_e6=(kp6_430e-1)/10
gen skal_part_f6=(kp6_430f-1)/10
gen skal_part_h6=(kp6_430h-1)/10
gen skal_part_i6=(kp6_430i-1)/10

gen skal_part_a7=(kp7_430a-1)/10
gen skal_part_b7=(kp7_430b-1)/10
gen skal_part_c7=(kp7_430c-1)/10
gen skal_part_d7=(kp7_430d-1)/10
gen skal_part_e7=(kp7_430e-1)/10
gen skal_part_f7=(kp7_430f-1)/10
gen skal_part_h7=(kp7_430h-1)/10
gen skal_part_i7=(kp7_430i-1)/10

replace skal_part_a1=round(skal_part_a1,.1)
replace skal_part_b1=round(skal_part_b1,.1)
replace skal_part_c1=round(skal_part_c1,.1)
replace skal_part_d1=round(skal_part_d1,.1)
replace skal_part_e1=round(skal_part_e1,.1)
replace skal_part_f1=round(skal_part_f1,.1)
replace skal_part_h1=round(skal_part_h1,.1)
replace skal_part_i1=round(skal_part_i1,.1)

replace skal_part_a2=round(skal_part_a2,.1)
replace skal_part_b2=round(skal_part_b2,.1)
replace skal_part_c2=round(skal_part_c2,.1)
replace skal_part_d2=round(skal_part_d2,.1)
replace skal_part_e2=round(skal_part_e2,.1)
replace skal_part_f2=round(skal_part_f2,.1)
replace skal_part_h2=round(skal_part_h2,.1)
replace skal_part_i2=round(skal_part_i2,.1)

replace skal_part_a3=round(skal_part_a3,.1)
replace skal_part_b3=round(skal_part_b3,.1)
replace skal_part_c3=round(skal_part_c3,.1)
replace skal_part_d3=round(skal_part_d3,.1)
replace skal_part_e3=round(skal_part_e3,.1)
replace skal_part_f3=round(skal_part_f3,.1)
replace skal_part_h3=round(skal_part_h3,.1)
replace skal_part_i3=round(skal_part_i3,.1)

replace skal_part_a4=round(skal_part_a4,.1)
replace skal_part_b4=round(skal_part_b4,.1)
replace skal_part_c4=round(skal_part_c4,.1)
replace skal_part_d4=round(skal_part_d4,.1)
replace skal_part_e4=round(skal_part_e4,.1)
replace skal_part_f4=round(skal_part_f4,.1)
replace skal_part_h4=round(skal_part_h4,.1)
replace skal_part_i4=round(skal_part_i4,.1)

replace skal_part_a5=round(skal_part_a5,.1)
replace skal_part_b5=round(skal_part_b5,.1)
replace skal_part_c5=round(skal_part_c5,.1)
replace skal_part_d5=round(skal_part_d5,.1)
replace skal_part_e5=round(skal_part_e5,.1)
replace skal_part_f5=round(skal_part_f5,.1)
replace skal_part_h5=round(skal_part_h5,.1)
replace skal_part_i5=round(skal_part_i5,.1)

replace skal_part_a6=round(skal_part_a6,.1)
replace skal_part_b6=round(skal_part_b6,.1)
replace skal_part_c6=round(skal_part_c6,.1)
replace skal_part_d6=round(skal_part_d6,.1)
replace skal_part_e6=round(skal_part_e6,.1)
replace skal_part_f6=round(skal_part_f6,.1)
replace skal_part_h6=round(skal_part_h6,.1)
replace skal_part_i6=round(skal_part_i6,.1)

replace skal_part_a7=round(skal_part_a7,.1)
replace skal_part_b7=round(skal_part_b7,.1)
replace skal_part_c7=round(skal_part_c7,.1)
replace skal_part_d7=round(skal_part_d7,.1)
replace skal_part_e7=round(skal_part_e7,.1)
replace skal_part_f7=round(skal_part_f7,.1)
replace skal_part_h7=round(skal_part_h7,.1)
replace skal_part_i7=round(skal_part_i7,.1)
tab1 skal_part_a7-skal_part_i7


tab1 skal_part_a1 skal_part_b1
gen skal_part_union1=skal_part_a1 if kpx_2601 !=9
replace skal_part_union1=skal_part_b1 if kpx_2601 ==9
gen skal_part_union2=skal_part_a2 if kpx_2601 !=9
replace skal_part_union2=skal_part_b2 if kpx_2601 ==9
gen skal_part_union3=skal_part_a3 if kpx_2601 !=9
replace skal_part_union3=skal_part_b3 if kpx_2601 ==9
gen skal_part_union4=skal_part_a4 if kpx_2601 !=9
replace skal_part_union4=skal_part_b4 if kpx_2601 ==9
gen skal_part_union5=skal_part_a5 if kpx_2601 !=9
replace skal_part_union5=skal_part_b5 if kpx_2601 ==9
gen skal_part_union6=skal_part_a6 if kpx_2601 !=9
replace skal_part_union6=skal_part_b6 if kpx_2601 ==9
gen skal_part_union7=skal_part_a7 if kpx_2601 !=9
replace skal_part_union7=skal_part_b7 if kpx_2601 ==9

egen maxskalo1h=rowmax(skal_part_union1 skal_part_c1 skal_part_d1 skal_part_e1 skal_part_f1)
egen maxskalo2h=rowmax(skal_part_union2 skal_part_c2 skal_part_d2 skal_part_e2 skal_part_f2)
egen maxskalo3h=rowmax(skal_part_union3 skal_part_c3 skal_part_d3 skal_part_e3 skal_part_f3)
egen maxskalo4h=rowmax(skal_part_union4 skal_part_c4 skal_part_d4 skal_part_e4 skal_part_f4)
egen maxskalo5h=rowmax(skal_part_union5 skal_part_c5 skal_part_d5 skal_part_e5 skal_part_f5)
egen maxskalo6h=rowmax(skal_part_union6 skal_part_c6 skal_part_d6 skal_part_e6 skal_part_f6)
egen maxskalo7h=rowmax(skal_part_union7 skal_part_c7 skal_part_d7 skal_part_e7 skal_part_f7)

replace maxskalo1=maxskalo1h
replace maxskalo2=maxskalo2h
replace maxskalo3=maxskalo3h
replace maxskalo4=maxskalo4h
replace maxskalo5=maxskalo5h
replace maxskalo6=maxskalo6h
replace maxskalo7=maxskalo7h
tab1 maxskalo1-maxskalo7

gen maxunion1=0
replace maxunion1=1 if maxskalo1==skal_part_union1
gen maxunion2=0
replace maxunion2=1 if maxskalo2==skal_part_union2
gen maxunion3=0
replace maxunion3=1 if maxskalo3==skal_part_union3
gen maxunion4=0
replace maxunion4=1 if maxskalo4==skal_part_union4
gen maxunion5=0
replace maxunion5=1 if maxskalo5==skal_part_union5
gen maxunion6=0
replace maxunion6=1 if maxskalo6==skal_part_union6
gen maxunion7=0
replace maxunion7=1 if maxskalo7==skal_part_union7

gen maxc1=0
replace maxc1=1 if maxskalo1==skal_part_c1
gen maxc2=0
replace maxc2=1 if maxskalo2==skal_part_c2
gen maxc3=0
replace maxc3=1 if maxskalo3==skal_part_c3
gen maxc4=0
replace maxc4=1 if maxskalo4==skal_part_c4
gen maxc5=0
replace maxc5=1 if maxskalo5==skal_part_c5
gen maxc6=0
replace maxc6=1 if maxskalo6==skal_part_c6
gen maxc7=0
replace maxc7=1 if maxskalo7==skal_part_c7

gen maxd1=0
replace maxd1=1 if maxskalo1==skal_part_d1
gen maxd2=0
replace maxd2=1 if maxskalo2==skal_part_d2
gen maxd3=0
replace maxd3=1 if maxskalo3==skal_part_d3
gen maxd4=0
replace maxd4=1 if maxskalo4==skal_part_d4
gen maxd5=0
replace maxd5=1 if maxskalo5==skal_part_d5
gen maxd6=0
replace maxd6=1 if maxskalo6==skal_part_d6
gen maxd7=0
replace maxd7=1 if maxskalo7==skal_part_d7

gen maxe1=0
replace maxe1=1 if maxskalo1==skal_part_e1
gen maxe2=0
replace maxe2=1 if maxskalo2==skal_part_e2
gen maxe3=0
replace maxe3=1 if maxskalo3==skal_part_e3
gen maxe4=0
replace maxe4=1 if maxskalo4==skal_part_e4
gen maxe5=0
replace maxe5=1 if maxskalo5==skal_part_e5
gen maxe6=0
replace maxe6=1 if maxskalo6==skal_part_e6
gen maxe7=0
replace maxe7=1 if maxskalo7==skal_part_e7

gen maxf1=0
replace maxf1=1 if maxskalo1==skal_part_f1
gen maxf2=0
replace maxf2=1 if maxskalo2==skal_part_f2
gen maxf3=0
replace maxf3=1 if maxskalo3==skal_part_f3
gen maxf4=0
replace maxf4=1 if maxskalo4==skal_part_f4
gen maxf5=0
replace maxf5=1 if maxskalo5==skal_part_f5
gen maxf6=0
replace maxf6=1 if maxskalo6==skal_part_f6
gen maxf7=0
replace maxf7=1 if maxskalo7==skal_part_f7

tab maxskalo1 skal_part_union1

* Indifference.
* without AfD and Pirates because of comparability with 2009.

egen max2skalo1c=rowmax(skal_part_c1 skal_part_d1 skal_part_e1 skal_part_f1) if maxunion1==1
egen max2skalo2c=rowmax(skal_part_c2 skal_part_d2 skal_part_e2 skal_part_f2) if maxunion1==1
egen max2skalo3c=rowmax(skal_part_c3 skal_part_d3 skal_part_e3 skal_part_f3) if maxunion1==1
egen max2skalo4c=rowmax(skal_part_c4 skal_part_d4 skal_part_e4 skal_part_f4) if maxunion1==1
egen max2skalo5c=rowmax(skal_part_c5 skal_part_d5 skal_part_e5 skal_part_f5) if maxunion1==1
egen max2skalo6c=rowmax(skal_part_c6 skal_part_d6 skal_part_e6 skal_part_f6) if maxunion1==1
egen max2skalo7c=rowmax(skal_part_c7 skal_part_d7 skal_part_e7 skal_part_f7) if maxunion1==1

egen max2skalo1s=rowmax(skal_part_union1 skal_part_d1 skal_part_e1 skal_part_f1) if maxc1==1
egen max2skalo2s=rowmax(skal_part_union2 skal_part_d2 skal_part_e2 skal_part_f2) if maxc1==1
egen max2skalo3s=rowmax(skal_part_union3 skal_part_d3 skal_part_e3 skal_part_f3) if maxc1==1
egen max2skalo4s=rowmax(skal_part_union4 skal_part_d4 skal_part_e4 skal_part_f4) if maxc1==1
egen max2skalo5s=rowmax(skal_part_union5 skal_part_d5 skal_part_e5 skal_part_f5) if maxc1==1
egen max2skalo6s=rowmax(skal_part_union6 skal_part_d6 skal_part_e6 skal_part_f6) if maxc1==1
egen max2skalo7s=rowmax(skal_part_union7 skal_part_d7 skal_part_e7 skal_part_f7) if maxc1==1

egen max2skalo1f=rowmax(skal_part_union1 skal_part_c1 skal_part_e1 skal_part_f1) if maxd1==1
egen max2skalo2f=rowmax(skal_part_union2 skal_part_c2 skal_part_e2 skal_part_f2) if maxd1==1
egen max2skalo3f=rowmax(skal_part_union3 skal_part_c3 skal_part_e3 skal_part_f3) if maxd1==1
egen max2skalo4f=rowmax(skal_part_union4 skal_part_c4 skal_part_e4 skal_part_f4) if maxd1==1
egen max2skalo5f=rowmax(skal_part_union5 skal_part_c5 skal_part_e5 skal_part_f5) if maxd1==1
egen max2skalo6f=rowmax(skal_part_union6 skal_part_c6 skal_part_e6 skal_part_f6) if maxd1==1
egen max2skalo7f=rowmax(skal_part_union7 skal_part_c7 skal_part_e7 skal_part_f7) if maxd1==1

egen max2skalo1g=rowmax(skal_part_union1 skal_part_d1 skal_part_c1 skal_part_f1) if maxe1==1
egen max2skalo2g=rowmax(skal_part_union2 skal_part_d2 skal_part_c2 skal_part_f2) if maxe1==1
egen max2skalo3g=rowmax(skal_part_union3 skal_part_d3 skal_part_c3 skal_part_f3) if maxe1==1
egen max2skalo4g=rowmax(skal_part_union4 skal_part_d4 skal_part_c4 skal_part_f4) if maxe1==1
egen max2skalo5g=rowmax(skal_part_union5 skal_part_d5 skal_part_c5 skal_part_f5) if maxe1==1
egen max2skalo6g=rowmax(skal_part_union6 skal_part_d6 skal_part_c6 skal_part_f6) if maxe1==1
egen max2skalo7g=rowmax(skal_part_union7 skal_part_d7 skal_part_c7 skal_part_f7) if maxe1==1

egen max2skalo1l=rowmax(skal_part_union1 skal_part_d1 skal_part_c1 skal_part_e1) if maxf1==1
egen max2skalo2l=rowmax(skal_part_union2 skal_part_d2 skal_part_c2 skal_part_e2) if maxf1==1
egen max2skalo3l=rowmax(skal_part_union3 skal_part_d3 skal_part_c3 skal_part_e3) if maxf1==1
egen max2skalo4l=rowmax(skal_part_union4 skal_part_d4 skal_part_c4 skal_part_e4) if maxf1==1
egen max2skalo5l=rowmax(skal_part_union5 skal_part_d5 skal_part_c5 skal_part_e5) if maxf1==1
egen max2skalo6l=rowmax(skal_part_union6 skal_part_d6 skal_part_c6 skal_part_e6) if maxf1==1
egen max2skalo7l=rowmax(skal_part_union7 skal_part_d7 skal_part_c7 skal_part_e7) if maxf1==1

tab1 max2skalo1c-max2skalo7l

gen indiff1= 1-(maxskalo1-max2skalo1c) if maxunion1==1
replace indiff1= 1-(maxskalo1-max2skalo1s) if maxc1==1
replace indiff1= 1-(maxskalo1-max2skalo1f) if maxd1==1
replace indiff1= 1-(maxskalo1-max2skalo1g) if maxe1==1
replace indiff1= 1-(maxskalo1-max2skalo1l) if maxf1==1
replace indiff1=round(indiff1,.1)
tab indiff1

gen indiff2= 1-(maxskalo2-max2skalo2c) if maxunion2==1
replace indiff2= 1-(maxskalo2-max2skalo2s) if maxc2==1
replace indiff2= 1-(maxskalo2-max2skalo2f) if maxd2==1
replace indiff2= 1-(maxskalo2-max2skalo2g) if maxe2==1
replace indiff2= 1-(maxskalo2-max2skalo2l) if maxf2==1
replace indiff2=round(indiff2,.1)

gen indiff3= 1-(maxskalo3-max2skalo3c) if maxunion3==1
replace indiff3= 1-(maxskalo3-max2skalo3s) if maxc3==1
replace indiff3= 1-(maxskalo3-max2skalo3f) if maxd3==1
replace indiff3= 1-(maxskalo3-max2skalo3g) if maxe3==1
replace indiff3= 1-(maxskalo3-max2skalo3l) if maxf3==1
replace indiff3=round(indiff3,.1)

gen indiff4= 1-(maxskalo4-max2skalo4c) if maxunion4==1
replace indiff4= 1-(maxskalo4-max2skalo4s) if maxc4==1
replace indiff4= 1-(maxskalo4-max2skalo4f) if maxd4==1
replace indiff4= 1-(maxskalo4-max2skalo4g) if maxe4==1
replace indiff4= 1-(maxskalo4-max2skalo4l) if maxf4==1
replace indiff4=round(indiff4,.1)

gen indiff5= 1-(maxskalo5-max2skalo5c) if maxunion5==1
replace indiff5= 1-(maxskalo5-max2skalo5s) if maxc5==1
replace indiff5= 1-(maxskalo5-max2skalo5f) if maxd5==1
replace indiff5= 1-(maxskalo5-max2skalo5g) if maxe5==1
replace indiff5= 1-(maxskalo5-max2skalo5l) if maxf5==1
replace indiff5=round(indiff5,.1)

gen indiff6= 1-(maxskalo6-max2skalo6c) if maxunion6==1
replace indiff6= 1-(maxskalo6-max2skalo6s) if maxc6==1
replace indiff6= 1-(maxskalo6-max2skalo6f) if maxd6==1
replace indiff6= 1-(maxskalo6-max2skalo6g) if maxe6==1
replace indiff6= 1-(maxskalo6-max2skalo6l) if maxf6==1
replace indiff6=round(indiff6,.1)

gen indiff7= 1-(maxskalo7-max2skalo7c) if maxunion7==1
replace indiff7= 1-(maxskalo7-max2skalo7s) if maxc7==1
replace indiff7= 1-(maxskalo7-max2skalo7f) if maxd7==1
replace indiff7= 1-(maxskalo7-max2skalo7g) if maxe7==1
replace indiff7= 1-(maxskalo7-max2skalo7l) if maxf7==1
replace indiff7=round(indiff7,.1)

tab1 indiff1-indiff7

* Alienation
* Without AfD and Pirates, see above.

generate entfremd1=(((skal_part_union1+skal_part_c1+skal_part_d1+skal_part_e1+skal_part_f1)/-5)+1)
generate entfremd2=(((skal_part_union2+skal_part_c2+skal_part_d2+skal_part_e2+skal_part_f2)/-5)+1)
generate entfremd3=(((skal_part_union3+skal_part_c3+skal_part_d3+skal_part_e3+skal_part_f3)/-5)+1)
generate entfremd4=(((skal_part_union4+skal_part_c4+skal_part_d4+skal_part_e4+skal_part_f4)/-5)+1)
generate entfremd5=(((skal_part_union5+skal_part_c5+skal_part_d5+skal_part_e5+skal_part_f5)/-5)+1)
generate entfremd6=(((skal_part_union6+skal_part_c6+skal_part_d6+skal_part_e6+skal_part_f6)/-5)+1)
generate entfremd7=(((skal_part_union7+skal_part_c7+skal_part_d7+skal_part_e7+skal_part_f7)/-5)+1)
tab1 entfremd1-entfremd7

generate entfremda1=(maxskalo1-1)*-1
generate entfremda2=(maxskalo2-1)*-1
generate entfremda3=(maxskalo3-1)*-1
generate entfremda4=(maxskalo4-1)*-1
generate entfremda5=(maxskalo5-1)*-1
generate entfremda6=(maxskalo6-1)*-1
generate entfremda7=(maxskalo7-1)*-1
tab1 entfremda1-entfremda7



***********************************************************************************
* Split variable
*

* Strength party identification

tab1 kp1_2090a kp1_2100
tab1 kp1_2090a kp1_2100, nolabel
mvdecode kp?_2100, mv(-99/-1)

foreach welle of numlist 1 3 5 7 {
	recode kp`welle'_2100 (4 5=0.25) (3=0.5) (2=0.75) (1=1), gen(pid_staerke`welle')
	replace pid_staerke`welle'=0 if kp`welle'_2090a==808
	}

keep lfdn wkampfint? wahlnorm? intefficacy? extefficacy? zufr? indiff? ///
	entfremd? entfremda? pid_staerke? 

save "${path}\Reproducible Do-Files\Chapter 5\Data\attitudes13.dta", replace	

